package name.fowler.refactoring.simplestore;

public class Movie {
		private String m_Title;
		private PriceCodes m_PriceCode;

		public Movie(String title, PriceCodes priceCode) {
				m_Title = title;
				m_PriceCode = priceCode;
		}

		public String getTitle() {
				return m_Title;
		}

		public double bill(int period) {
				switch (m_PriceCode) {
				case Regular:
						return 2. + Math.max(period - 2, 0.) * 1.5;
				case NewRelease:
						return period * 3.;
				case Childrens:
						return 1.5 + Math.max(period - 3, 0.) * 1.5;
				default:
						return 9999;
				}
		}

		public int bonus(int period) {
				if ( m_PriceCode == PriceCodes.NewRelease && period > 1 )
						return 1;
				else
						return 0;
		}

}

